<template>
    <div>
        <h1>门店显示</h1>
    </div>
    <table class="table table-bordered">
        <tbody>
            <tr>
                <td><input type="checkbox" v-model="check" @click="xuan"></td>
                <td>ID</td>

                <td>门店名称</td>
                <td>分店名称</td>
                <td>门店图片</td>
                <td>开业时间</td>
                <td>酒店状态</td>
                <td>酒店特色</td>
                <td>门店介绍</td>
                <td>门店地址</td>
                <td>门店类型</td>
                <td>操作</td>
            </tr>
            <tr v-for="item in data.list" :key="item.shopId">
                <td><input type="checkbox" v-model="ids" :value="item.shopId"></td>
                <td>{{ item.shopId }} </td>
                <td>{{ item.shopName }}</td>
                <td>{{ item.branchName }}</td>
                <td><img :src="item.shopImg" width="120" height="120"></td>
                <td>{{ item.openTime.substring(0, 10) }}</td>
                <td>{{ item.state == 1 ? "是" : "否" }}</td>
                <td>{{ item.feature }}</td>
                <td>{{ item.desc }}</td>
                <td>{{ item.addressName }}</td>
                <td>{{ item.hotelType }}</td>

                <td>
                    <input type="botton" value="删除" class="btn btn-danger">
                    <input type="botton" value="修改" class="btn btn-primary">
                    <input type="botton" value="开启" class="btn btn-warning">
                    <input type="botton" value="禁用" class="btn btn-info">
                </td>
            </tr>
        </tbody>
    </table>
    <div>共<b>{{ data.totalcount }}</b>条</div>
</template>
<!-- ========================数据=========================== -->
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import axios from 'axios';

let info: any = reactive({
    pageindex: 1,
    pagesize: 7,
    shopName: "",
    address: "",
})
let data: any = reactive({
    list: [],
    totalcount: 0,
    totalpage: 0
})

onMounted(() => {
    Getshop();
})

const Getshop = () => {
    axios({
        url: 'https://localhost:7155/api/User/GetShop',
        method: 'get',
        params: info,
    })
        .then((rec) => {
            console.log(rec);
            Object.assign(data, rec.data)


        })
        .catch(err => {
            console.log(err);

        })
}
let check: any = ref(false);

let ids: any = ref([]);


const checkOne=()=>{

}






const xuan = () => {
    check.value = !check.value
    if(check.value==true)
{
    ids.value=data.list.map((item:any)=>{
        return item.shopId;
    });
}
else
{
    ids.value=[];
}
    
}

</script>

<style scoped></style>